<template>
  <div class="auth">
    <van-nav-bar
      title="实名认证中心"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="auth-main">
      <div class="auth-main-left">
        <img src="@/assets/img/swiper/3.jpg">
      </div>
      <div class="auth-main-right">
        <div class="auth-main-right-name">{{processName}}</div>
        <span>{{processId}}</span>
      </div>
    </div>
  </div>
  
</template>

<script>
export default {
  data() {
    return  {
      name:'',
      idnumber:'',
    }
  },
  computed:{
    // 姓名
    processName(){
      let  value = this.name
      if(null != value && value != undefined){
        let star = '';
        if(value.length <= 2){
          return  value.substring(0,1) + "*" ;
        } else {
          for (var i = 0; i < value.length-2; i++) {
            star= star + '*'
          }
          return value.substring(0,1)+ star + value.substring(value.length-1,value.length);
        }
      }
    },
    // 身份证号
    processId() {
      let value = this.idnumber
      if(value==null) return '无'
     return value.replace(/(\w{8})\w*(\w{2})/, '$1******$2')
   }
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1)
    },
    getAuthentication(){
      this.name = this.$store.state.userInfo.RealInformation.RealName
      this.idnumber = this.$store.state.userInfo.RealInformation.IDCard
    },
  },
  created(){
    this.getAuthentication()
  },
}
</script>

<style lang="less">
.auth-main {
  display: flex;
  justify-content:flex-start;
  align-items:center;
  margin-top: 20px;
  width: 100%;
  height: 103px;
  line-height: 20px;
  border-radius: 20px 20px 20px 20px;
  background-color: rgba(98, 166, 235, 100);
  text-align: center;
  .auth-main-left {
    img {
      margin-left: 10px;
      width: 77px;
      height: 77px;
      border-radius: 20px 20px 20px 20px;
    }
  }
  .auth-main-right {
    margin-left: 20px;
    .auth-main-right-name {
      margin-bottom: 10px;
      font-size: 18px;
      text-align: left;
      font-family: PingFangSC-regular;
      color: rgba(255, 255, 255, 100);
    }
    span {
      margin-top: 15px;
      color: rgba(255, 255, 255, 100);
      font-size: 18px;
      text-align: left;
      font-family: PingFangSC-regular;
    }
  }
  
}
</style>